import 'package:bitotus_web/platform.dart';
import 'package:bitotus_web/download_button.dart';
import 'package:bitotus_web/responsive.dart';
import 'package:flutter/material.dart';
import 'package:flutter_kit/underground/underground.dart';

import 'font.dart';
import "package:universal_html/html.dart" as html;

class MainPage extends StatelessWidget {
  const MainPage({super.key});

  @override
  Widget build(BuildContext context) {
    final size = MediaQuery.of(context).size;
    print("SIZE:${size.shortestSide}×${size.longestSide}");

    Platform platform = getPlatform();

    return PageSkeleton(
      child: Column(
        children: [
          Text(
            "开发者：酸性量子 | 邮箱：lucidquantum@163.com | 电话：+86 159 0078 0010",
            textAlign: TextAlign.center,
            style: context.subtitleStyle.copyWith(
              color: COLOR.grey,
              letterSpacing: 2,
            ),
          ),
          const Space(ratio: 3),
          Text(
            "Bitotus\nGamification\nApp",
            textAlign: TextAlign.center,
            style: context.titleStyle,
          ),
          SizedBox(
            height: context.responsive<double>(
              40,
              pad: 30,
              phone: 20,
            ),
          ),
          Text(
            "用编程，变万物为游戏",
            textAlign: TextAlign.center,
            style: context.subtitleStyle,
          ),
          const Space(ratio: 3),
          DownloadButton(
            enable: platform.isOpen,
            onTap: () => downloadApp(platform),
            english: platform == Platform.Unknown
                ? html.window.navigator.platform!
                : platform.name,
            chinese: platform.isOpen ? "下载应用" : "暂未开放",
          ),
          const Space(ratio: 1),
          Text(
            "浙ICP备2021031261号-2",
            textAlign: TextAlign.center,
            style: context.subtitleStyle.copyWith(
              color: COLOR.grey,
              letterSpacing: 2,
            ),
          ),
        ],
      ),
    );
  }
}
